home *** CD-ROM | disk | FTP | other *** search
- Path: newsfeed.direct.ca!usenet
- From: mkla@direct.ca (Mike Klajnert)
- Newsgroups: comp.lang.c
- Subject: Question for "C" programmers.
- Date: Sat, 06 Jan 1996 14:42:26 GMT
- Organization: Internet Direct
- Message-ID: <4cm8mt$hlc@grid.direct.ca>
- NNTP-Posting-Host: 204.174.249.121
- X-Newsreader: Forte Free Agent 1.0.82
-
-
- Hi
-
- This is my question for all "C" programmers who
- knows how to talk to news server.
-
- My problem is that I can send only one command to news server,
- then I'll receive a respons. To the next command server is
- not responding.
-
- here is part of code
-
-
- iRet = send( hSocket, (LPSTR)command, strlen( command)+1,
- NO_FLAGS);
-
- if ( iRet == SOCKET_ERROR &&
- WSAGetLastError() != WSAEWOULDBLOCK) {
- MessageBox( NULL, "The send() function returned a socket
- error.",
- PROG_NAME, MB_OK|MB_ICONSTOP);
- iLastError = WSAGetLastError();
- }
- else {
- iLength = recv( hSocket, (LPSTR)sReceiveBuffer,
- sizeof( sReceiveBuffer), NO_FLAGS);
-
-
- if ( iLength == 0 || iLength == SOCKET_ERROR ) {
- MessageBox(NULL, "The recv() function returned a socket
- error.",
- PROG_NAME, MB_OK|MB_ICONSTOP);
- }
- sReceiveBuffer[iLength] = '\0';
-
- sscanf( sReceiveBuffer, "%hd %hd %hd %hd %s",
- &GroupInfo.error, &GroupInfo.numberofarticles,
- &GroupInfo.fromarticlenumber,
- &GroupInfo.toarticlenumber,
- GroupInfo.groupname);
- }
-
-
- sprintf( command, "HEAD %hd\015\012",
- GroupInfo.fromarticlenumber);
-
- iLength = strlen( command);
-
- iRet = send( hSocket, (LPSTR)command, iLength+1, NO_FLAGS);
-
- if ( iRet == SOCKET_ERROR &&
- WSAGetLastError() != WSAEWOULDBLOCK) {
- MessageBox(NULL, "The send() function returned a socket
- error.",
- PROG_NAME, MB_OK|MB_ICONSTOP);
- iLastError = WSAGetLastError();
- }
- else {
-
- iLength = recv( hSocket, (LPSTR)sReceiveBuffer,
- 1024, NO_FLAGS);
-
- at this point recv waits forever
-
- it doesen't meatter if it is HEAD or QUIT after second send
- I don't get any response from server.
-
- any ideas?
-
- all help appreciated.
-
- mkla@direct.ca
-
-
-
-